
		**********************************************************
		** File: Table_B3.do									**
		** Paper: Human Trafficking Indicators: A New Dataset	**
		** Author: Richard Frank								**
		** Date: July 11, 2021									**
		** Task: Generating intercoder reliability stats		**
 		**********************************************************
 
	clear
	version 16.1
	set seed 1234
	
	***************
	*** SHEET 1 ***
	***************
	
	import excel "/Human Trafficking Indicators, 2000-2016.xlsx", sheet("Sheet_1") firstrow case(lower) clear

	** THEN I HAVE TO RENAME ALL VARIABLES TO A CONSISTENT TYPE **
	
							**********
							**TIERS **
							**********

	rename tier tierstring
	gen tier=.
	replace tier=1 if tierstring=="Tier 1"
	replace tier=2 if tierstring=="Tier 2"
	replace tier=2 if tierstring=="Tier 2 Watch List"
	replace tier=3 if tierstring=="Tier 3"
	drop tierstring
	label var tier "TIP Tiers with WL as 2, SC=."

	rename sourcecountry source_order

	replace source_order="0" if source_order=="No Mention"
	replace source_order="1" if source_order=="First Mention Source" 
	replace source_order="2" if source_order=="Second Mention Source" 
	replace source_order="3" if source_order=="Third Mention Source" 
	destring source_order, replace
	label var source_order "Source country mentioned 1st/2nd/3rd"

	gen source=0
	replace source=1 if source_order ==1
	replace source=1 if source_order ==2
	replace source=1 if source_order ==3
	label var source "Source Country, yes=1, 0=no"


	rename destinationcountry destination_order
	replace destination_order ="0" if destination_order =="No Mention"
	replace destination_order ="1" if destination_order =="First Mention Destination" 
	replace destination_order ="2" if destination_order =="Second Mention Destination" 
	replace destination_order ="3" if destination_order =="Third Mention Destination" 
	destring destination_order, replace
	label var destination_order "Destination country mentioned 1st/2nd/3rd"

	gen destination=0
	replace destination=1 if destination_order==1
	replace destination=1 if destination_order==2
	replace destination=1 if destination_order==3
	label var destination "Destination Country, yes=1, 0=no"

	rename transitcountry transit_order
	replace transit_order ="0" if transit_order =="No mention"
	replace transit_order ="1" if transit_order =="First Mention Transit" 
	replace transit_order ="2" if transit_order =="Second Mention Transit" 
	replace transit_order ="3" if transit_order =="Third Mention Transit" 
	destring transit_order, replace
	label var transit_order "Transit country? 1st/2nd/3rd"

	gen transit=0
	replace transit=1 if transit_order==1
	replace transit=1 if transit_order==2
	replace transit=1 if transit_order==3
	label var transit "Transit Country, yes=1, 0=no"

	rename  internaltrafficking internal
	replace internal="-1" if internal=="No"
	replace internal="1" if internal=="Yes"
	replace internal="0" if internal=="No Mention"
	destring internal, replace
	label var internal "Internal trafficking"

	rename  protocoltopreventsupressand protocol
	tab protocol
	gen protocol2=0
	replace protocol2=2 if protocol=="Ratifiation" 
	replace protocol2=2 if protocol=="Ratifiation, Accession" 
	replace protocol2=1 if protocol=="Signature"
	replace protocol2=2 if protocol=="Signature, Ratifiation"
	replace protocol2=2 if protocol=="Signature, Ratifiation, Acceptance" 
	replace protocol2=2 if protocol=="Signature, Ratifiation, Accession"
	label var protocol2 "1 Protocol signed, 2 signed and ratified"
	tab protocol2
	drop protocol
	rename protocol2 protocol

						******************
						** PROSTITUTION **
						******************

	rename forcedprostitutionsource psource
	tab psource
	replace psource="0" if psource=="No mention"
	replace psource="-1" if psource=="No"
	replace psource="1" if psource=="Yes"
	destring psource, replace 
	label var psource "Forced Prostitution Source"

	rename forcedprostitutiondestination pdest
	replace pdest="0" if pdest=="No mention"
	replace pdest="-1" if pdest=="No"
	replace pdest="1" if pdest=="Yes"
	destring pdest, replace 
	label var pdest "Forced Prostitution Destination"

	rename forcedprostitutiontransit ptransit
	replace ptransit="0" if ptransit=="No Mention"
	replace ptransit="-1" if ptransit=="No"
	replace ptransit="1" if ptransit=="Yes"
	destring ptransit, replace 
	label var ptransit "Forced Prostitution Transit"

	rename internalforcedprostitution pinternal
	replace pinternal="0" if pinternal=="No Mention"
	replace pinternal="-1" if pinternal=="No"
	replace pinternal="1" if pinternal=="Yes"
	destring pinternal, replace 
	label var pinternal "Forced Prostitution Internal"

					***********
					** LABOR **
					***********

	rename forcedlabordestination ldest
	replace ldest="0" if ldest=="No Mention"
	replace ldest="-1" if ldest=="No"
	replace ldest="1" if ldest=="Yes"
	destring ldest, replace 
	label var ldest "Forced Labor Destination"

	rename forcedlaborsource lsource
	replace lsource="0" if lsource=="No Mention"
	replace lsource="-1" if lsource=="No"
	replace lsource="1" if lsource=="Yes"
	destring lsource, replace 
	label var lsource "Forced Labor Source"

	rename forcedlabortransit ltransit
	replace ltransit="0" if ltransit=="No Mention"
	replace ltransit="-1" if ltransit=="No"
	replace ltransit="1" if ltransit=="Yes"
	destring ltransit, replace 
	label var ltransit "Forced Labor Transit"

	rename internalforcedlabor linternal
	replace linternal="0" if linternal=="No Mention"
	replace linternal="-1" if linternal=="No"
	replace linternal="1" if linternal=="Yes"
	destring linternal, replace 
	label var linternal "Forced Labor Internal"

	********************
	** CHILD SOLDIERS **
	********************

	rename childsoldierssource csource
	replace csource="0" if csource=="No Mention"
	replace csource="-1" if csource=="No"
	replace csource="1" if csource=="Yes"
	destring csource, replace 
	label var csource "Child Soldiers Source"

	rename childsoldiersdestination cdest
	replace cdest="0" if cdest=="No Mention"
	replace cdest="-1" if cdest=="No"
	replace cdest="1" if cdest=="Yes"
	destring cdest, replace 
	label var cdest "Child Soldiers Destination"

	rename childsoldierstransit ctransit
	replace ctransit="0" if ctransit=="No Mention"
	replace ctransit="0" if ctransit=="No mention"
	replace ctransit="-1" if ctransit=="No"
	replace ctransit="1" if ctransit=="Yes"
	destring ctransit, replace 
	label var ctransit "Child Soldiers Transit"

	rename internalchildsoldiers cinternal
	replace cinternal="0" if cinternal=="No Mention"
	replace cinternal="0" if cinternal=="No mention"
	replace cinternal="-1" if cinternal=="No"
	replace cinternal="1" if cinternal=="Yes"
	destring cinternal, replace 
	label var cinternal "Child Soldiers Internal"

	******************
	** DEBT BONDAGE **
	******************

	rename debtbondagesource dsource
	replace dsource="0" if dsource=="No Mention"
	replace dsource="-1" if dsource=="No"
	replace dsource="1" if dsource=="Yes"
	destring dsource, replace 
	label var dsource "Debt Bondage Source"

	rename debtbondagedestination ddest
	replace ddest="0" if ddest=="No Mention"
	replace ddest="-1" if ddest=="No"
	replace ddest="1" if ddest=="Yes"
	destring ddest, replace 
	label var ddest "Debt Bondage Destination"

	rename debtbondagetransit dtransit
	replace dtransit="0" if dtransit=="No Mention"
	replace dtransit="-1" if dtransit=="No"
	replace dtransit="1" if dtransit=="Yes"
	destring dtransit, replace 
	label var dtransit "Debt Bondage Transit"

	rename internaldebtbondage dinternal
	replace dinternal="0" if dinternal=="No Mention"
	replace dinternal="-1" if dinternal=="No"
	replace dinternal="1" if dinternal=="Yes"
	destring dinternal, replace 
	label var dinternal "Debt Bondage Internal"

	************************
	** DOMESTIC SERVITUDE **
	************************

	rename involuntarydomesticservitudes dssource
	replace dssource="0" if dssource=="No Mention"
	replace dssource="-1" if dssource=="No"
	replace dssource="1" if dssource=="Yes"
	destring dssource, replace 
	label var dssource "Domestic Servitude Source"

	rename involuntarydomesticservituded dsdest
	replace dsdest="0" if dsdest=="No Mention"
	replace dsdest="-1" if dsdest=="No"
	replace dsdest="1" if dsdest=="Yes"
	destring dsdest, replace 
	label var dsdest "Domestic Servitude Destination"

	rename involuntarydomesticservitudet dstransit
	replace dstransit="0" if dstransit=="No Mention"
	replace dstransit="-1" if dstransit=="No"
	replace dstransit="1" if dstransit=="Yes"
	destring dstransit, replace 
	label var dstransit "Domestic Servitude Transit"

	rename internalinvoluntarydomesticse dsinternal
	replace dsinternal="0" if dsinternal=="No Mention"
	replace dsinternal="-1" if dsinternal=="No"
	replace dsinternal="1" if dsinternal=="Yes"
	destring dsinternal, replace 
	label var dsinternal "Domestic Servitude Internal"

						*****************
						** CHILD LABOR **
						*****************
						
	rename forcedchildlaborsource clsource
	replace clsource="0" if clsource=="No Mention"
	replace clsource="-1" if clsource=="No"
	replace clsource="1" if clsource=="Yes"
	destring clsource, replace 
	label var clsource "Child Labor Source"

	rename forcedchildlabordestination cldest
	replace cldest="0" if cldest=="No Mention"
	replace cldest="-1" if cldest=="No"
	replace cldest="1" if cldest=="Yes"
	destring cldest, replace 
	label var cldest "Child Labor Destination"

	rename forcedchildlabortransit cltransit
	replace cltransit="0" if cltransit=="No Mention"
	replace cltransit="-1" if cltransit=="No"
	replace cltransit="1" if cltransit=="Yes"
	destring cltransit, replace 
	label var cltransit "Child Labor Transit"

	rename internalforcedchildlabor clinternal
	replace clinternal="0" if clinternal=="No Mention"
	replace clinternal="-1" if clinternal=="No"
	replace clinternal="1" if clinternal=="Yes"
	destring clinternal, replace 
	label var clinternal "Child Labor Internal"

	** CHILD SEX **
	rename childsextraffickingsource cssource
	replace cssource="0" if cssource=="No Mention"
	replace cssource="-1" if cssource=="No"
	replace cssource="1" if cssource=="Yes"
	destring cssource, replace 
	label var cssource "Child Sex Source"

	rename childsextraffickingdestinatio  csdest
	replace csdest="0" if csdest=="No Mention"
	replace csdest="-1" if csdest=="No"
	replace csdest="1" if csdest=="Yes"
	destring csdest, replace 
	label var csdest "Child Sex Destination"

	rename childsextraffickingtransit cstransit
	replace cstransit="0" if cstransit=="No Mention"
	replace cstransit="-1" if cstransit=="No"
	replace cstransit="1" if cstransit=="Yes"
	destring cstransit, replace 
	label var cstransit "Child Sex Transit"

	rename internalchildsextrafficking csinternal
	replace csinternal="0" if csinternal=="No Mention"
	replace csinternal="-1" if csinternal=="No"
	replace csinternal="1" if csinternal=="Yes"
	destring csinternal, replace 
	label var csinternal "Child Sex Internal"


	*****************
	** PROSECUTION **
	*****************

	replace domesticlaws="-1" if domesticlaws=="No"
	replace domesticlaws="0" if domesticlaws=="No Mention"
	replace domesticlaws="1" if domesticlaws=="Some"
	replace domesticlaws="2" if domesticlaws=="Yes"
	destring domesticlaws, replace
	label var domesticlaws "Domestic laws prohibiting trafficking"

	rename doesthiscountryenforcedomest enforcement
	replace enforcement="0" if enforcement=="No Mention"
	replace enforcement="-1" if enforcement=="No"
	replace enforcement="-1" if enforcement=="No "	
	replace enforcement="2" if enforcement=="Yes"
	replace enforcement="1" if enforcement=="Some"
	destring enforcement, replace 
	label var enforcement "Do they enforce domestic laws?"

	rename doesthiscountrysgovernmentp convictinfo
	tab convictinfo
	replace convictinfo="0" if convictinfo=="No Mention"
	replace convictinfo="-1" if convictinfo=="No"
	replace convictinfo="1" if convictinfo=="Yes"
	destring convictinfo, replace
	label var convictinfo "Provide info on convictions?"

	rename howmanycitizenswereprosecute prosnum
	set more off
	tab prosnum
	replace prosnum="" if prosnum=="unknown"
	replace prosnum="" if prosnum=="Unknown"
	replace prosnum="" if prosnum=="unkown"
	replace prosnum="" if prosnum=="NA"
	replace prosnum="" if prosnum=="N/A"	
	replace prosnum="" if prosnum=="No mention"
	replace prosnum="" if prosnum=="No mention "	
	replace prosnum="" if prosnum=="no mention"
	replace prosnum="" if prosnum=="No Mention"
	replace prosnum="" if prosnum=="no data available"
	destring prosnum, replace
	label var prosnum "# prosecuted for trafficking"

							****************
							** PROTECTION **
							****************
							
	rename minimumstandards minstand
	tab minstand
	replace minstand="0" if minstand=="No Mention"
	replace minstand="-1" if minstand=="No"
	replace minstand="1" if minstand=="Yes"
	destring minstand, replace
	label var minstand "Fully comply with minimum standards"
	 
	 rename hasthiscountrymademinimalpr protectprogress
	tab protectprogress
	replace protectprogress="0" if protectprogress=="No Mention"
	replace protectprogress="-1" if protectprogress=="No"
	replace protectprogress="1" if protectprogress=="Yes"
	destring protectprogress, replace
	label var protectprogress "Min. progress in protecting"

	rename doesthiscountryhaveformalpr victimid
	tab victimid
	replace victimid="0" if victimid=="No Mention"
	replace victimid="-1" if victimid=="No"
	replace victimid="1" if victimid=="Yes"
	destring victimid, replace
	label var victimid "Formal procedures for victim ID"

	rename au victimservices
	tab victimservices
	replace victimservices="0" if victimservices=="No Mention"
	replace victimservices="-1" if victimservices=="No"
	replace victimservices="1" if victimservices=="Yes"
	destring victimservices, replace
	label var victimservices "Provide victim services not thru NGOs"

	rename doesthiscountrypunishvictims victimpunish
	tab victimpunish
	replace victimpunish="0" if victimpunish=="No Mention"
	replace victimpunish="-1" if victimpunish=="No"
	replace victimpunish="1" if victimpunish=="Yes"
	destring victimpunish, replace
	label var victimpunish "Punish victims for acts committed"

	replace efforts="-1" if efforts =="No"
	replace efforts="-1" if efforts =="No "	
	replace efforts ="1" if efforts =="Some"
	replace efforts ="2" if efforts =="Yes"
	replace efforts ="0" if efforts =="No Mention"
	destring efforts, replace
	label var efforts "Significant efforts at combatting?"

	rename aw progress
	replace progress="-1" if progress=="No"
	replace progress="0" if progress=="No Mention"
	replace progress="1" if progress=="Some"
	replace progress="2" if progress=="Yes"
	destring progress, replace
	label var progress "Minimal progress in prevention?"

	sort countryname year
	drop timestamp

	 
	rename countryname Country

	run "cow.do"
	label var year "Year"
	tab Country if ccode==0
	tab Country
	rename Country country
	
	drop if ccode==0
	codebook year
	tab year
	replace year="2009" if year=="2008-2009"
	replace year="2010" if year=="2009-2010"	
	destring year, replace
 
	
	order  country year  tier source source_order transit transit_order ///
	destination destination_order internal psource ptransit pdest ///
	pinternal lsource ltransit ldest linternal dsource dtransit ddest dinternal ///
	dssource dstransit dsdest dsinternal clsource cltransit cldest clinternal cssource ///
	cstransit csdest csinternal csource ctransit cdest cinternal  domesticlaws enforcement ///
	convictinfo prosnum minstand efforts protectprogress victimid  victimservices victimpunish progress ///
	 protocol
	
	save "sheet_1.dta", replace
	
********************************************************************************
********************************************************************************

						***************
						*** SHEET 2 ***
						***************
						
	import excel "Human Trafficking Indicators, 2000-2016.xlsx", sheet("Sheet_2") firstrow case(lower) clear		
	
							**********
							**TIERS **
							**********

	rename tier tierstring
	gen tier=.
	replace tier=1 if tierstring=="Tier 1"
	replace tier=2 if tierstring=="Tier 2"
	replace tier=2 if tierstring=="Tier 2 Watch List"
	replace tier=3 if tierstring=="Tier 3"
	drop tierstring
	label var tier "TIP Tiers with WL as 2, SC=."

	rename sourcecountry source_order

	replace source_order="0" if source_order=="No Mention"
	replace source_order="1" if source_order=="First Mention Source" 
	replace source_order="2" if source_order=="Second Mention Source" 
	replace source_order="3" if source_order=="Third Mention Source" 
	destring source_order, replace
	label var source_order "Source country mentioned 1st/2nd/3rd"

	gen source=0
	replace source=1 if source_order ==1
	replace source=1 if source_order ==2
	replace source=1 if source_order ==3
	label var source "Source Country, yes=1, 0=no"


	rename destinationcountry destination_order
	replace destination_order ="0" if destination_order =="No Mention"
	replace destination_order ="1" if destination_order =="First Mention Destination" 
	replace destination_order ="2" if destination_order =="Second Mention Destination" 
	replace destination_order ="3" if destination_order =="Third Mention Destination" 
	destring destination_order, replace
	label var destination_order "Destination country mentioned 1st/2nd/3rd"

	gen destination=0
	replace destination=1 if destination_order==1
	replace destination=1 if destination_order==2
	replace destination=1 if destination_order==3
	label var destination "Destination Country, yes=1, 0=no"

	rename transitcountry transit_order
	replace transit_order ="0" if transit_order =="No mention"
	replace transit_order ="1" if transit_order =="First Mention Transit" 
	replace transit_order ="2" if transit_order =="Second Mention Transit" 
	replace transit_order ="3" if transit_order =="Third Mention Transit" 
	destring transit_order, replace
	label var transit_order "Transit country? 1st/2nd/3rd"

	gen transit=0
	replace transit=1 if transit_order==1
	replace transit=1 if transit_order==2
	replace transit=1 if transit_order==3
	label var transit "Transit Country, yes=1, 0=no"

	rename  internaltrafficking internal
	replace internal="-1" if internal=="No"
	replace internal="1" if internal=="Yes"
	replace internal="0" if internal=="No Mention"
	destring internal, replace
	label var internal "Internal trafficking"

	rename  protocoltopreventsupressand protocol
	tab protocol
	gen protocol2=0
	replace protocol2=2 if protocol=="Ratifiation" 
	replace protocol2=2 if protocol=="Ratifiation, Accession" 
	replace protocol2=1 if protocol=="Signature"
	replace protocol2=2 if protocol=="Signature, Ratifiation"
	replace protocol2=2 if protocol=="Signature, Ratifiation, Acceptance" 
	replace protocol2=2 if protocol=="Signature, Ratifiation, Accession"
	label var protocol2 "1 Protocol signed, 2 signed and ratified"
	tab protocol2
	drop protocol
	rename protocol2 protocol

						******************
						** PROSTITUTION **
						******************

	rename forcedprostitutionsource psource
	tab psource
	replace psource="0" if psource=="No mention"
	replace psource="-1" if psource=="No"
	replace psource="1" if psource=="Yes"
	destring psource, replace 
	label var psource "Forced Prostitution Source"

	rename forcedprostitutiondestination pdest
	replace pdest="0" if pdest=="No mention"
	replace pdest="-1" if pdest=="No"
	replace pdest="1" if pdest=="Yes"
	destring pdest, replace 
	label var pdest "Forced Prostitution Destination"

	rename forcedprostitutiontransit ptransit
	replace ptransit="0" if ptransit=="No Mention"
	replace ptransit="-1" if ptransit=="No"
	replace ptransit="1" if ptransit=="Yes"
	destring ptransit, replace 
	label var ptransit "Forced Prostitution Transit"

	rename internalforcedprostitution pinternal
	replace pinternal="0" if pinternal=="No Mention"
	replace pinternal="-1" if pinternal=="No"
	replace pinternal="1" if pinternal=="Yes"
	destring pinternal, replace 
	label var pinternal "Forced Prostitution Internal"

					***********
					** LABOR **
					***********

	rename forcedlabordestination ldest
	replace ldest="0" if ldest=="No Mention"
	replace ldest="-1" if ldest=="No"
	replace ldest="1" if ldest=="Yes"
	destring ldest, replace 
	label var ldest "Forced Labor Destination"

	rename forcedlaborsource lsource
	replace lsource="0" if lsource=="No Mention"
	replace lsource="-1" if lsource=="No"
	replace lsource="1" if lsource=="Yes"
	destring lsource, replace 
	label var lsource "Forced Labor Source"

	rename forcedlabortransit ltransit
	replace ltransit="0" if ltransit=="No Mention"
	replace ltransit="-1" if ltransit=="No"
	replace ltransit="1" if ltransit=="Yes"
	destring ltransit, replace 
	label var ltransit "Forced Labor Transit"

	rename internalforcedlabor linternal
	replace linternal="0" if linternal=="No Mention"
	replace linternal="-1" if linternal=="No"
	replace linternal="1" if linternal=="Yes"
	destring linternal, replace 
	label var linternal "Forced Labor Internal"

	********************
	** CHILD SOLDIERS **
	********************

	rename childsoldierssource csource
	replace csource="0" if csource=="No Mention"
	replace csource="-1" if csource=="No"
	replace csource="1" if csource=="Yes"
	destring csource, replace 
	label var csource "Child Soldiers Source"

	rename childsoldiersdestination cdest
	replace cdest="0" if cdest=="No Mention"
	replace cdest="-1" if cdest=="No"
	replace cdest="1" if cdest=="Yes"
	destring cdest, replace 
	label var cdest "Child Soldiers Destination"

	rename childsoldierstransit ctransit
	replace ctransit="0" if ctransit=="No Mention"
	replace ctransit="0" if ctransit=="No mention"
	replace ctransit="-1" if ctransit=="No"
	replace ctransit="1" if ctransit=="Yes"
	destring ctransit, replace 
	label var ctransit "Child Soldiers Transit"

	rename internalchildsoldiers cinternal
	replace cinternal="0" if cinternal=="No Mention"
	replace cinternal="0" if cinternal=="No mention"
	replace cinternal="-1" if cinternal=="No"
	replace cinternal="1" if cinternal=="Yes"
	destring cinternal, replace 
	label var cinternal "Child Soldiers Internal"

	******************
	** DEBT BONDAGE **
	******************

	rename debtbondagesource dsource
	replace dsource="0" if dsource=="No Mention"
	replace dsource="-1" if dsource=="No"
	replace dsource="1" if dsource=="Yes"
	destring dsource, replace 
	label var dsource "Debt Bondage Source"

	rename debtbondagedestination ddest
	replace ddest="0" if ddest=="No Mention"
	replace ddest="-1" if ddest=="No"
	replace ddest="1" if ddest=="Yes"
	destring ddest, replace 
	label var ddest "Debt Bondage Destination"

	rename debtbondagetransit dtransit
	replace dtransit="0" if dtransit=="No Mention"
	replace dtransit="-1" if dtransit=="No"
	replace dtransit="1" if dtransit=="Yes"
	destring dtransit, replace 
	label var dtransit "Debt Bondage Transit"

	rename internaldebtbondage dinternal
	replace dinternal="0" if dinternal=="No Mention"
	replace dinternal="-1" if dinternal=="No"
	replace dinternal="1" if dinternal=="Yes"
	destring dinternal, replace 
	label var dinternal "Debt Bondage Internal"

	************************
	** DOMESTIC SERVITUDE **
	************************

	rename involuntarydomesticservitudes dssource
	replace dssource="0" if dssource=="No Mention"
	replace dssource="-1" if dssource=="No"
	replace dssource="1" if dssource=="Yes"
	destring dssource, replace 
	label var dssource "Domestic Servitude Source"

	rename involuntarydomesticservituded dsdest
	replace dsdest="0" if dsdest=="No Mention"
	replace dsdest="-1" if dsdest=="No"
	replace dsdest="1" if dsdest=="Yes"
	destring dsdest, replace 
	label var dsdest "Domestic Servitude Destination"

	rename involuntarydomesticservitudet dstransit
	replace dstransit="0" if dstransit=="No Mention"
	replace dstransit="-1" if dstransit=="No"
	replace dstransit="1" if dstransit=="Yes"
	destring dstransit, replace 
	label var dstransit "Domestic Servitude Transit"

	rename internalinvoluntarydomesticse dsinternal
	replace dsinternal="0" if dsinternal=="No Mention"
	replace dsinternal="-1" if dsinternal=="No"
	replace dsinternal="1" if dsinternal=="Yes"
	destring dsinternal, replace 
	label var dsinternal "Domestic Servitude Internal"

						*****************
						** CHILD LABOR **
						*****************
						
	rename forcedchildlaborsource clsource
	replace clsource="0" if clsource=="No Mention"
	replace clsource="-1" if clsource=="No"
	replace clsource="1" if clsource=="Yes"
	destring clsource, replace 
	label var clsource "Child Labor Source"

	rename forcedchildlabordestination cldest
	replace cldest="0" if cldest=="No Mention"
	replace cldest="-1" if cldest=="No"
	replace cldest="1" if cldest=="Yes"
	destring cldest, replace 
	label var cldest "Child Labor Destination"

	rename forcedchildlabortransit cltransit
	replace cltransit="0" if cltransit=="No Mention"
	replace cltransit="-1" if cltransit=="No"
	replace cltransit="1" if cltransit=="Yes"
	destring cltransit, replace 
	label var cltransit "Child Labor Transit"

	rename internalforcedchildlabor clinternal
	replace clinternal="0" if clinternal=="No Mention"
	replace clinternal="-1" if clinternal=="No"
	replace clinternal="1" if clinternal=="Yes"
	destring clinternal, replace 
	label var clinternal "Child Labor Internal"

	** CHILD SEX **
	rename childsextraffickingsource cssource
	replace cssource="0" if cssource=="No Mention"
	replace cssource="-1" if cssource=="No"
	replace cssource="1" if cssource=="Yes"
	destring cssource, replace 
	label var cssource "Child Sex Source"

	rename childsextraffickingdestinatio  csdest
	replace csdest="0" if csdest=="No Mention"
	replace csdest="-1" if csdest=="No"
	replace csdest="1" if csdest=="Yes"
	destring csdest, replace 
	label var csdest "Child Sex Destination"

	rename childsextraffickingtransit cstransit
	replace cstransit="0" if cstransit=="No Mention"
	replace cstransit="-1" if cstransit=="No"
	replace cstransit="1" if cstransit=="Yes"
	destring cstransit, replace 
	label var cstransit "Child Sex Transit"

	rename internalchildsextrafficking csinternal
	replace csinternal="0" if csinternal=="No Mention"
	replace csinternal="-1" if csinternal=="No"
	replace csinternal="1" if csinternal=="Yes"
	destring csinternal, replace 
	label var csinternal "Child Sex Internal"


	*****************
	** PROSECUTION **
	*****************

	replace domesticlaws="-1" if domesticlaws=="No"
	replace domesticlaws="0" if domesticlaws=="No Mention"
	replace domesticlaws="1" if domesticlaws=="Some"
	replace domesticlaws="2" if domesticlaws=="Yes"
	destring domesticlaws, replace
	label var domesticlaws "Domestic laws prohibiting trafficking"

	rename doesthiscountryenforcedomest enforcement
	replace enforcement="0" if enforcement=="No Mention"
	replace enforcement="-1" if enforcement=="No"
	replace enforcement="-1" if enforcement=="No "	
	replace enforcement="2" if enforcement=="Yes"
	replace enforcement="1" if enforcement=="Some"
	destring enforcement, replace 
	label var enforcement "Do they enforce domestic laws?"

	rename doesthiscountrysgovernmentp convictinfo
	tab convictinfo
	replace convictinfo="0" if convictinfo=="No Mention"
	replace convictinfo="-1" if convictinfo=="No"
	replace convictinfo="1" if convictinfo=="Yes"
	destring convictinfo, replace
	label var convictinfo "Provide info on convictions?"

	rename howmanycitizenswereprosecute prosnum
	set more off
	tab prosnum
	replace prosnum="" if prosnum=="unknown"
	replace prosnum="" if prosnum=="Unknown"
	replace prosnum="" if prosnum=="unkown"
	replace prosnum="" if prosnum=="NA"
	replace prosnum="" if prosnum=="N/A"	
	replace prosnum="" if prosnum=="No mention"
	replace prosnum="" if prosnum=="No mention "	
	replace prosnum="" if prosnum=="no mention"
	replace prosnum="" if prosnum=="No Mention"
	replace prosnum="" if prosnum=="no data available"
	destring prosnum, replace
	label var prosnum "# prosecuted for trafficking"

							****************
							** PROTECTION **
							****************
							
	rename minimumstandards minstand
	tab minstand
	replace minstand="0" if minstand=="No Mention"
	replace minstand="-1" if minstand=="No"
	replace minstand="1" if minstand=="Yes"
	destring minstand, replace
	label var minstand "Fully comply with minimum standards"
	 
	 rename hasthiscountrymademinimalpr protectprogress
	tab protectprogress
	replace protectprogress="0" if protectprogress=="No Mention"
	replace protectprogress="-1" if protectprogress=="No"
	replace protectprogress="1" if protectprogress=="Yes"
	destring protectprogress, replace
	label var protectprogress "Min. progress in protecting"

	rename doesthiscountryhaveformalpr victimid
	tab victimid
	replace victimid="0" if victimid=="No Mention"
	replace victimid="-1" if victimid=="No"
	replace victimid="1" if victimid=="Yes"
	destring victimid, replace
	label var victimid "Formal procedures for victim ID"

	rename ar victimservices
	tab victimservices
	replace victimservices="0" if victimservices=="No Mention"
	replace victimservices="-1" if victimservices=="No"
	replace victimservices="1" if victimservices=="Yes"
	destring victimservices, replace
	label var victimservices "Provide victim services not thru NGOs"

	rename doesthiscountrypunishvictims victimpunish
	tab victimpunish
	replace victimpunish="0" if victimpunish=="No Mention"
	replace victimpunish="-1" if victimpunish=="No"
	replace victimpunish="1" if victimpunish=="Yes"
	destring victimpunish, replace
	label var victimpunish "Punish victims for acts committed"

	replace efforts="-1" if efforts =="No"
	replace efforts="-1" if efforts =="No "	
	replace efforts ="1" if efforts =="Some"
	replace efforts ="2" if efforts =="Yes"
	replace efforts ="0" if efforts =="No Mention"
	destring efforts, replace
	label var efforts "Significant efforts at combatting?"

	rename au progress
	replace progress="-1" if progress=="No"
	replace progress="0" if progress=="No Mention"
	replace progress="1" if progress=="Some"
	replace progress="2" if progress=="Yes"
	destring progress, replace
	label var progress "Minimal progress in prevention?"

	sort countryname year
	drop timestamp

	 
	rename countryname Country

	run "cow.do"
	label var year "Year"
	tab Country if ccode==0
	tab Country
	rename Country country
	
	drop if ccode==0
 
	** NEED TO CLEAN COW CODES FOR CHINA and Norway **
	
	order  country year  tier source source_order transit transit_order ///
	destination destination_order internal psource ptransit pdest ///
	pinternal lsource ltransit ldest linternal dsource dtransit ddest dinternal ///
	dssource dstransit dsdest dsinternal clsource cltransit cldest clinternal cssource ///
	cstransit csdest csinternal csource ctransit cdest cinternal  domesticlaws enforcement ///
	convictinfo prosnum minstand efforts protectprogress victimid  victimservices victimpunish progress ///
	 protocol
	
	save "sheet_2.dta", replace
	
	
********************************************************************************
********************************************************************************
 			
						***************
						*** SHEET 3 ***
						***************
							
		import excel "/Human Trafficking Indicators, 2000-2016.xlsx", sheet("Sheet_3") firstrow case(lower) clear
		
							**********
							**TIERS **
							**********

	rename tier tierstring
	gen tier=.
	replace tier=1 if tierstring=="Tier 1"
	replace tier=2 if tierstring=="Tier 2"
	replace tier=2 if tierstring=="Tier 2 Watch List"
	replace tier=3 if tierstring=="Tier 3"
	drop tierstring
	label var tier "TIP Tiers with WL as 2, SC=."

	rename sourcecountry source_order

	replace source_order="0" if source_order=="No Mention"
	replace source_order="1" if source_order=="First Mention Source" 
	replace source_order="2" if source_order=="Second Mention Source" 
	replace source_order="3" if source_order=="Third Mention Source" 
	destring source_order, replace
	label var source_order "Source country mentioned 1st/2nd/3rd"

	gen source=0
	replace source=1 if source_order ==1
	replace source=1 if source_order ==2
	replace source=1 if source_order ==3
	label var source "Source Country, yes=1, 0=no"


	rename destinationcountry destination_order
	replace destination_order ="0" if destination_order =="No Mention"
	replace destination_order ="1" if destination_order =="First Mention Destination" 
	replace destination_order ="2" if destination_order =="Second Mention Destination" 
	replace destination_order ="3" if destination_order =="Third Mention Destination" 
	destring destination_order, replace
	label var destination_order "Destination country mentioned 1st/2nd/3rd"

	gen destination=0
	replace destination=1 if destination_order==1
	replace destination=1 if destination_order==2
	replace destination=1 if destination_order==3
	label var destination "Destination Country, yes=1, 0=no"

	rename transitcountry transit_order
	replace transit_order ="0" if transit_order =="No mention"
	replace transit_order ="1" if transit_order =="First Mention Transit" 
	replace transit_order ="2" if transit_order =="Second Mention Transit" 
	replace transit_order ="3" if transit_order =="Third Mention Transit" 
	destring transit_order, replace
	label var transit_order "Transit country? 1st/2nd/3rd"

	gen transit=0
	replace transit=1 if transit_order==1
	replace transit=1 if transit_order==2
	replace transit=1 if transit_order==3
	label var transit "Transit Country, yes=1, 0=no"

	rename  internaltrafficking internal
	replace internal="-1" if internal=="No"
	replace internal="1" if internal=="Yes"
	replace internal="0" if internal=="No Mention"
	destring internal, replace
	label var internal "Internal trafficking"

	rename  protocoltopreventsupressand protocol
	tab protocol
	gen protocol2=0
	replace protocol2=2 if protocol=="Ratifiation" 
	replace protocol2=2 if protocol=="Ratifiation, Accession" 
	replace protocol2=1 if protocol=="Signature"
	replace protocol2=2 if protocol=="Signature, Ratifiation"
	replace protocol2=2 if protocol=="Signature, Ratifiation, Acceptance" 
	replace protocol2=2 if protocol=="Signature, Ratifiation, Accession"
	label var protocol2 "1 Protocol signed, 2 signed and ratified"
	tab protocol2
	drop protocol
	rename protocol2 protocol

						******************
						** PROSTITUTION **
						******************

	rename forcedprostitutionsource psource
	tab psource
	replace psource="0" if psource=="No mention"
	replace psource="-1" if psource=="No"
	replace psource="1" if psource=="Yes"
	destring psource, replace 
	label var psource "Forced Prostitution Source"

	rename forcedprostitutiondestination pdest
	replace pdest="0" if pdest=="No mention"
	replace pdest="-1" if pdest=="No"
	replace pdest="1" if pdest=="Yes"
	destring pdest, replace 
	label var pdest "Forced Prostitution Destination"

	rename forcedprostitutiontransit ptransit
	replace ptransit="0" if ptransit=="No Mention"
	replace ptransit="-1" if ptransit=="No"
	replace ptransit="1" if ptransit=="Yes"
	destring ptransit, replace 
	label var ptransit "Forced Prostitution Transit"

	rename internalforcedprostitution pinternal
	replace pinternal="0" if pinternal=="No Mention"
	replace pinternal="-1" if pinternal=="No"
	replace pinternal="1" if pinternal=="Yes"
	destring pinternal, replace 
	label var pinternal "Forced Prostitution Internal"

					***********
					** LABOR **
					***********

	rename forcedlabordestination ldest
	replace ldest="0" if ldest=="No Mention"
	replace ldest="-1" if ldest=="No"
	replace ldest="1" if ldest=="Yes"
	destring ldest, replace 
	label var ldest "Forced Labor Destination"

	rename forcedlaborsource lsource
	replace lsource="0" if lsource=="No Mention"
	replace lsource="-1" if lsource=="No"
	replace lsource="1" if lsource=="Yes"
	destring lsource, replace 
	label var lsource "Forced Labor Source"

	rename forcedlabortransit ltransit
	replace ltransit="0" if ltransit=="No Mention"
	replace ltransit="-1" if ltransit=="No"
	replace ltransit="1" if ltransit=="Yes"
	destring ltransit, replace 
	label var ltransit "Forced Labor Transit"

	rename internalforcedlabor linternal
	replace linternal="0" if linternal=="No Mention"
	replace linternal="-1" if linternal=="No"
	replace linternal="1" if linternal=="Yes"
	destring linternal, replace 
	label var linternal "Forced Labor Internal"

	********************
	** CHILD SOLDIERS **
	********************

	rename childsoldierssource csource
	replace csource="0" if csource=="No Mention"
	replace csource="-1" if csource=="No"
	replace csource="1" if csource=="Yes"
	destring csource, replace 
	label var csource "Child Soldiers Source"

	rename childsoldiersdestination cdest
	replace cdest="0" if cdest=="No Mention"
	replace cdest="-1" if cdest=="No"
	replace cdest="1" if cdest=="Yes"
	destring cdest, replace 
	label var cdest "Child Soldiers Destination"

	rename childsoldierstransit ctransit
	replace ctransit="0" if ctransit=="No Mention"
	replace ctransit="0" if ctransit=="No mention"
	replace ctransit="-1" if ctransit=="No"
	replace ctransit="1" if ctransit=="Yes"
	destring ctransit, replace 
	label var ctransit "Child Soldiers Transit"

	rename internalchildsoldiers cinternal
	replace cinternal="0" if cinternal=="No Mention"
	replace cinternal="0" if cinternal=="No mention"
	replace cinternal="-1" if cinternal=="No"
	replace cinternal="1" if cinternal=="Yes"
	destring cinternal, replace 
	label var cinternal "Child Soldiers Internal"

	******************
	** DEBT BONDAGE **
	******************

	rename debtbondagesource dsource
	replace dsource="0" if dsource=="No Mention"
	replace dsource="-1" if dsource=="No"
	replace dsource="1" if dsource=="Yes"
	destring dsource, replace 
	label var dsource "Debt Bondage Source"

	rename debtbondagedestination ddest
	replace ddest="0" if ddest=="No Mention"
	replace ddest="-1" if ddest=="No"
	replace ddest="1" if ddest=="Yes"
	destring ddest, replace 
	label var ddest "Debt Bondage Destination"

	rename debtbondagetransit dtransit
	replace dtransit="0" if dtransit=="No Mention"
	replace dtransit="-1" if dtransit=="No"
	replace dtransit="1" if dtransit=="Yes"
	destring dtransit, replace 
	label var dtransit "Debt Bondage Transit"

	rename internaldebtbondage dinternal
	replace dinternal="0" if dinternal=="No Mention"
	replace dinternal="-1" if dinternal=="No"
	replace dinternal="1" if dinternal=="Yes"
	destring dinternal, replace 
	label var dinternal "Debt Bondage Internal"

	************************
	** DOMESTIC SERVITUDE **
	************************

	rename involuntarydomesticservitudes dssource
	replace dssource="0" if dssource=="No Mention"
	replace dssource="-1" if dssource=="No"
	replace dssource="1" if dssource=="Yes"
	destring dssource, replace 
	label var dssource "Domestic Servitude Source"

	rename involuntarydomesticservituded dsdest
	replace dsdest="0" if dsdest=="No Mention"
	replace dsdest="-1" if dsdest=="No"
	replace dsdest="1" if dsdest=="Yes"
	destring dsdest, replace 
	label var dsdest "Domestic Servitude Destination"

	rename involuntarydomesticservitudet dstransit
	replace dstransit="0" if dstransit=="No Mention"
	replace dstransit="-1" if dstransit=="No"
	replace dstransit="1" if dstransit=="Yes"
	destring dstransit, replace 
	label var dstransit "Domestic Servitude Transit"

	rename internalinvoluntarydomesticse dsinternal
	replace dsinternal="0" if dsinternal=="No Mention"
	replace dsinternal="-1" if dsinternal=="No"
	replace dsinternal="1" if dsinternal=="Yes"
	destring dsinternal, replace 
	label var dsinternal "Domestic Servitude Internal"

						*****************
						** CHILD LABOR **
						*****************
						
	rename forcedchildlaborsource clsource
	replace clsource="0" if clsource=="No Mention"
	replace clsource="-1" if clsource=="No"
	replace clsource="1" if clsource=="Yes"
	destring clsource, replace 
	label var clsource "Child Labor Source"

	rename forcedchildlabordestination cldest
	replace cldest="0" if cldest=="No Mention"
	replace cldest="-1" if cldest=="No"
	replace cldest="1" if cldest=="Yes"
	destring cldest, replace 
	label var cldest "Child Labor Destination"

	rename forcedchildlabortransit cltransit
	replace cltransit="0" if cltransit=="No Mention"
	replace cltransit="-1" if cltransit=="No"
	replace cltransit="1" if cltransit=="Yes"
	destring cltransit, replace 
	label var cltransit "Child Labor Transit"

	rename internalforcedchildlabor clinternal
	replace clinternal="0" if clinternal=="No Mention"
	replace clinternal="-1" if clinternal=="No"
	replace clinternal="1" if clinternal=="Yes"
	destring clinternal, replace 
	label var clinternal "Child Labor Internal"

	** CHILD SEX **
	rename childsextraffickingsource cssource
	replace cssource="0" if cssource=="No Mention"
	replace cssource="-1" if cssource=="No"
	replace cssource="1" if cssource=="Yes"
	destring cssource, replace 
	label var cssource "Child Sex Source"

	rename childsextraffickingdestinatio  csdest
	replace csdest="0" if csdest=="No Mention"
	replace csdest="-1" if csdest=="No"
	replace csdest="1" if csdest=="Yes"
	destring csdest, replace 
	label var csdest "Child Sex Destination"

	rename childsextraffickingtransit cstransit
	replace cstransit="0" if cstransit=="No Mention"
	replace cstransit="-1" if cstransit=="No"
	replace cstransit="1" if cstransit=="Yes"
	destring cstransit, replace 
	label var cstransit "Child Sex Transit"

	rename internalchildsextrafficking csinternal
	replace csinternal="0" if csinternal=="No Mention"
	replace csinternal="-1" if csinternal=="No"
	replace csinternal="1" if csinternal=="Yes"
	destring csinternal, replace 
	label var csinternal "Child Sex Internal"


	*****************
	** PROSECUTION **
	*****************

	replace domesticlaws="-1" if domesticlaws=="No"
	replace domesticlaws="0" if domesticlaws=="No Mention"
	replace domesticlaws="1" if domesticlaws=="Some"
	replace domesticlaws="2" if domesticlaws=="Yes"
	destring domesticlaws, replace
	label var domesticlaws "Domestic laws prohibiting trafficking"

	rename doesthiscountryenforcedomest enforcement
	replace enforcement="0" if enforcement=="No Mention"
	replace enforcement="-1" if enforcement=="No"
	replace enforcement="-1" if enforcement=="No "	
	replace enforcement="2" if enforcement=="Yes"
	replace enforcement="1" if enforcement=="Some"
	destring enforcement, replace 
	label var enforcement "Do they enforce domestic laws?"

	rename doesthiscountrysgovernmentp convictinfo
	tab convictinfo
	replace convictinfo="0" if convictinfo=="No Mention"
	replace convictinfo="-1" if convictinfo=="No"
	replace convictinfo="1" if convictinfo=="Yes"
	destring convictinfo, replace
	label var convictinfo "Provide info on convictions?"

	rename howmanycitizenswereprosecute prosnum
	set more off
	tab prosnum
	replace prosnum="" if prosnum=="unknown"
	replace prosnum="" if prosnum=="Unknown"
	replace prosnum="" if prosnum=="unkown"
	replace prosnum="" if prosnum=="NA"
	replace prosnum="" if prosnum=="N/A"	
	replace prosnum="" if prosnum=="No mention"
	replace prosnum="" if prosnum=="No mention "	
	replace prosnum="" if prosnum=="no mention"
	replace prosnum="" if prosnum=="No Mention"
	replace prosnum="" if prosnum=="no data available"
	destring prosnum, replace
	label var prosnum "# prosecuted for trafficking"

							****************
							** PROTECTION **
							****************
							
	rename minimumstandards minstand
	tab minstand
	replace minstand="0" if minstand=="No Mention"
	replace minstand="-1" if minstand=="No"
	replace minstand="1" if minstand=="Yes"
	destring minstand, replace
	label var minstand "Fully comply with minimum standards"
	 
	 rename hasthiscountrymademinimalpr protectprogress
	tab protectprogress
	replace protectprogress="0" if protectprogress=="No Mention"
	replace protectprogress="-1" if protectprogress=="No"
	replace protectprogress="1" if protectprogress=="Yes"
	destring protectprogress, replace
	label var protectprogress "Min. progress in protecting"

	rename doesthiscountryhaveformalpr victimid
	tab victimid
	replace victimid="0" if victimid=="No Mention"
	replace victimid="-1" if victimid=="No"
	replace victimid="1" if victimid=="Yes"
	destring victimid, replace
	label var victimid "Formal procedures for victim ID"

	rename ar victimservices
	tab victimservices
	replace victimservices="0" if victimservices=="No Mention"
	replace victimservices="-1" if victimservices=="No"
	replace victimservices="1" if victimservices=="Yes"
	destring victimservices, replace
	label var victimservices "Provide victim services not thru NGOs"

	rename doesthiscountrypunishvictims victimpunish
	tab victimpunish
	replace victimpunish="0" if victimpunish=="No Mention"
	replace victimpunish="-1" if victimpunish=="No"
	replace victimpunish="1" if victimpunish=="Yes"
	destring victimpunish, replace
	label var victimpunish "Punish victims for acts committed"

	replace efforts="-1" if efforts =="No"
	replace efforts="-1" if efforts =="No "	
	replace efforts ="1" if efforts =="Some"
	replace efforts ="2" if efforts =="Yes"
	replace efforts ="0" if efforts =="No Mention"
	destring efforts, replace
	label var efforts "Significant efforts at combatting?"

	rename au progress
	replace progress="-1" if progress=="No"
	replace progress="0" if progress=="No Mention"
	replace progress="1" if progress=="Some"
	replace progress="2" if progress=="Yes"
	destring progress, replace
	label var progress "Minimal progress in prevention?"

	sort countryname year
	drop timestamp

	 
	rename countryname Country

	run "cow.do"
	label var year "Year"
	tab Country if ccode==0
	tab Country
	rename Country country
	
	drop if ccode==0
 
	
	order  country year  tier source source_order transit transit_order ///
	destination destination_order internal psource ptransit pdest ///
	pinternal lsource ltransit ldest linternal dsource dtransit ddest dinternal ///
	dssource dstransit dsdest dsinternal clsource cltransit cldest clinternal cssource ///
	cstransit csdest csinternal csource ctransit cdest cinternal  domesticlaws enforcement ///
	convictinfo prosnum minstand efforts protectprogress victimid  victimservices victimpunish progress ///
	 protocol
	
	codebook prosnum
	tab prosnum
	replace prosnum="" if prosnum=="missing"
	destring prosnum, replace
	
	
	save "sheet_3.dta", replace		
		
	append using "sheet_2.dta"
 
	append using "/sheet_1.dta"
 
	codebook aw ax ay az ba	
	drop aw ax ay az ba	
	order country ccode year
	replace prosnum=. if prosnum==-99
	drop prosecuted
	
	save "intercoder_data.dta", replace	
		
		
	***********************************************	
	*** NOW DOING INTERCODER RELIABILITY CHECKS ***	
	***********************************************
	
	duplicates report ccode year	
	
		/* total obs is 2344, duplicates are 349 (15%)  */

	sort ccode year

	duplicates tag ccode year, gen(duplicate)

	sort ccode year
	order ccode country year duplicate 

	keep if duplicate~=0
	
	sort ccode year
	by ccode year: gen count=_n
 	order ccode country year count
	drop duplicate

	gen tier1=tier if count==1	
	gen tier2=tier if count==2
	gen tier3=tier if count==3	
 	gen tier4=tier if count==4
	drop tier
	
	gen source1= source if count==1
	gen source2= source if count==2	
	gen source3= source if count==3		
	gen source4= source if count==4	
	drop source
	
	gen source_order1 = source_order if count==1		
	gen source_order2 = source_order if count==2		
	gen source_order3 = source_order if count==3		
	gen source_order4 = source_order if count==4		
	drop source_order
	
	gen transit1 = transit if count==1		
	gen transit2 = transit if count==2		
	gen transit3 = transit if count==3		
	gen transit4 = transit if count==4			
	drop transit
	
	gen transit_order1 = transit_order if count==1		
	gen transit_order2 = transit_order if count==2		
	gen transit_order3 = transit_order if count==3		
	gen transit_order4 = transit_order if count==4		
	drop transit_order
	
	gen destination1 = destination if count==1		
	gen destination2 = destination if count==2		
	gen destination3 = destination if count==3		
	gen destination4 = destination if count==4			
	drop destination
	
	gen destination_order1 = destination_order if count==1		
	gen destination_order2 = destination_order if count==2		
	gen destination_order3 = destination_order if count==3		
	gen destination_order4 = destination_order if count==4			
	drop destination_order
	
	gen internal1 = internal if count==1		
	gen internal2 = internal if count==2		
	gen internal3 = internal if count==3		
	gen internal4 = internal if count==4		
	drop internal
	
	gen psource1  = psource  if count==1		
	gen psource2  = psource  if count==2		
	gen psource3  = psource  if count==3		
	gen psource4  = psource  if count==4		
	drop psource 	
	
	gen  ptransit1 = ptransit  if count==1		
	gen ptransit2 =  ptransit if count==2		
	gen ptransit3  =  ptransit if count==3		
	gen ptransit4  =  ptransit if count==4		
	drop ptransit 	
	
	gen pdest1  = pdest  if count==1		
	gen pdest2  = pdest  if count==2		
	gen pdest3  = pdest  if count==3		
	gen pdest4  = pdest  if count==4		
	drop  pdest	
		
	gen pinternal1  = pinternal  if count==1		
	gen pinternal2  =  pinternal if count==2		
	gen pinternal3  = pinternal  if count==3		
	gen pinternal4  =  pinternal if count==4		
	drop  pinternal	
		
	gen lsource1  = lsource  if count==1		
	gen lsource2  = lsource  if count==2		
	gen lsource3  = lsource  if count==3		
	gen lsource4  = lsource  if count==4		
	drop  lsource	
		
	gen ltransit1  = ltransit if count==1		
	gen ltransit2  = ltransit if count==2		
	gen ltransit3  = ltransit  if count==3		
	gen ltransit4  = ltransit  if count==4		
	drop  ltransit	
		
	gen ldest1  = ldest  if count==1		
	gen ldest2  = ldest  if count==2		
	gen ldest3  = ldest  if count==3		
	gen ldest4  = ldest  if count==4		
	drop ldest 	
		
	gen linternal1  =  linternal if count==1		
	gen linternal2  = linternal  if count==2		
	gen linternal3  = linternal  if count==3		
	gen linternal4  = linternal  if count==4		
	drop linternal  	
		
	gen dsource1  = dsource  if count==1		
	gen dsource2  = dsource  if count==2		
	gen dsource3  =  dsource if count==3		
	gen dsource4  = dsource  if count==4		
	drop dsource 	
		
	gen dtransit1  =  dtransit if count==1		
	gen dtransit2  = dtransit  if count==2		
	gen dtransit3 =  dtransit if count==3		
	gen dtransit4  =  dtransit if count==4		
	drop dtransit 	
		
	gen ddest1  = ddest  if count==1		
	gen ddest2 =  ddest if count==2		
	gen ddest3  = ddest  if count==3		
	gen ddest4  =  ddest if count==4		
	drop  ddest	
		
	gen dinternal1  =  dinternal if count==1		
	gen dinternal2  = dinternal  if count==2		
	gen dinternal3  =  dinternal if count==3		
	gen dinternal4  =  dinternal if count==4		
	drop  dinternal		
		
	gen dssource1  = dssource  if count==1		
	gen dssource2  = dssource  if count==2		
	gen dssource3  = dssource  if count==3		
	gen dssource4  =  dssource if count==4		
	drop  dssource	
		
	gen dstransit1  = dstransit  if count==1		
	gen dstransit2  =  dstransit if count==2		
	gen dstransit3  = dstransit  if count==3		
	gen dstransit4  =  dstransit if count==4		
	drop dstransit 	
		
	gen dsdest1  = dsdest  if count==1		
	gen dsdest2  = dsdest  if count==2		
	gen dsdest3  = dsdest if count==3		
	gen dsdest4  = dsdest  if count==4		
	drop  dsdest		
	
		
	gen dsinternal1 = dsinternal  if count==1		
	gen dsinternal2 =  dsinternal if count==2		
	gen dsinternal3 =  dsinternal if count==3		
	gen dsinternal4 =  dsinternal if count==4		
	drop dsinternal 	
		
	gen clsource1  = clsource  if count==1		
	gen clsource2  = clsource  if count==2		
	gen clsource3  = clsource  if count==3		
	gen clsource4  = clsource  if count==4		
	drop clsource 	
		
	gen cltransit1  =  cltransit if count==1		
	gen cltransit2  = cltransit  if count==2		
	gen cltransit3  = cltransit  if count==3		
	gen cltransit4  = cltransit  if count==4		
	drop cltransit 	
	
	gen cldest1  = cldest  if count==1		
	gen cldest2  = cldest  if count==2		
	gen cldest3  = cldest  if count==3		
	gen cldest4  =  cldest if count==4		
	drop cldest 		
		
	gen clinternal1  = clinternal  if count==1		
	gen clinternal2  = clinternal  if count==2		
	gen clinternal3  = clinternal  if count==3		
	gen clinternal4  = clinternal  if count==4		
	drop clinternal 		
	
	gen cssource1  = cssource  if count==1		
	gen cssource2  =  cssource if count==2		
	gen cssource3  = cssource  if count==3		
	gen cssource4  =  cssource if count==4		
	drop cssource 		
		
	gen cstransit1  =  cstransit if count==1		
	gen cstransit2  = cstransit  if count==2		
	gen cstransit3  = cstransit  if count==3		
	gen cstransit4  = cstransit  if count==4		
	drop  cstransit		
		
	gen csdest1  =  csdest if count==1		
	gen csdest2  = csdest  if count==2		
	gen csdest3  = csdest  if count==3		
	gen csdest4  = csdest  if count==4		
	drop csdest 		
		
	gen csinternal1 = csinternal  if count==1		
	gen csinternal2 = csinternal if count==2		
	gen csinternal3  = csinternal  if count==3		
	gen csinternal4  = csinternal  if count==4		
	drop  csinternal		
				
	gen csource1  = csource  if count==1		
	gen csource2  =  csource if count==2		
	gen csource3  = csource  if count==3		
	gen csource4  = csource  if count==4		
	drop  csource		
				
	gen ctransit1  = ctransit if count==1		
	gen ctransit2  = ctransit  if count==2		
	gen ctransit3  = ctransit if count==3		
	gen ctransit4  = ctransit  if count==4		
	drop ctransit  		
				
	gen cdest1  = cdest  if count==1		
	gen cdest2  = cdest  if count==2		
	gen cdest3  = cdest  if count==3		
	gen cdest4  = cdest  if count==4		
	drop cdest 
	
	gen cinternal1  = cinternal  if count==1		
	gen cinternal2  = cinternal  if count==2		
	gen cinternal3  = cinternal  if count==3		
	gen cinternal4  = cinternal  if count==4		
	drop  cinternal	
	
	gen domesticlaws1  = domesticlaws  if count==1		
	gen domesticlaws2  = domesticlaws  if count==2		
	gen domesticlaws3  = domesticlaws  if count==3		
	gen domesticlaws4  = domesticlaws  if count==4		
	drop domesticlaws 	
	
	gen enforcement1  = enforcement  if count==1		
	gen enforcement2  = enforcement  if count==2		
	gen enforcement3  = enforcement  if count==3		
	gen enforcement4  = enforcement  if count==4		
	drop enforcement 	
	
	gen convictinfo1  = convictinfo  if count==1		
	gen convictinfo2  = convictinfo  if count==2		
	gen convictinfo3  = convictinfo  if count==3		
	gen convictinfo4  = convictinfo  if count==4		
	drop convictinfo 	
		
	gen prosnum1  = prosnum  if count==1		
	gen prosnum2  =  prosnum if count==2		
	gen prosnum3  = prosnum  if count==3		
	gen prosnum4  = prosnum  if count==4		
	drop prosnum 	
		
	gen minstand1  = minstand  if count==1		
	gen minstand2  = minstand  if count==2		
	gen minstand3  = minstand  if count==3		
	gen minstand4  = minstand  if count==4		
	drop minstand 
	
	gen efforts1  = efforts  if count==1		
	gen efforts2  = efforts  if count==2		
	gen efforts3  = efforts  if count==3		
	gen efforts4  = efforts  if count==4		
	drop efforts 		
	
	gen protectprogress1  = protectprogress  if count==1		
	gen protectprogress2  = protectprogress  if count==2		
	gen protectprogress3  = protectprogress  if count==3		
	gen protectprogress4  = protectprogress  if count==4		
	drop protectprogress 
	
	gen victimid1  = victimid  if count==1		
	gen victimid2  = victimid  if count==2		
	gen victimid3  = victimid  if count==3		
	gen victimid4  = victimid  if count==4		
	drop victimid 	
	
	gen victimservices1  = victimservices  if count==1		
	gen victimservices2  = victimservices  if count==2		
	gen victimservices3  = victimservices  if count==3		
	gen  victimservices4 =  victimservices if count==4		
	drop victimservices 	

	gen victimpunish1  = victimpunish  if count==1		
	gen victimpunish2  = victimpunish  if count==2		
	gen victimpunish3  = victimpunish  if count==3		
	gen victimpunish4  = victimpunish  if count==4		
	drop victimpunish 	
		
	gen progress1  = progress  if count==1		
	gen progress2  = progress  if count==2		
	gen progress3  = progress  if count==3		
	gen progress4  =  progress if count==4		
	drop progress 	
	
	gen protocol1  = protocol  if count==1		
	gen protocol2 = protocol  if count==2		
	gen protocol3  = protocol  if count==3		
	gen protocol4  =  protocol if count==4		
	drop  protocol	
		

	********************************
	** COLLAPSING TO COUNTRY YEAR **

 
 collapse (max) tier* source1 source2 source3 source4 source_order1 source_order2 ///
			source_order3 source_order4 ///
		transit1 transit2 transit3 transit4 ///
		transit_order1  transit_order2 transit_order3 transit_order4 ///
		destination1  destination2 destination3 destination4 ///
		destination_order1  destination_order2 destination_order3  destination_order4 ///
		internal* psource* ptransit* pdest* pinternal* lsource* ///
		ltransit* ldest* linternal* dsource* dtransit* ddest* dinternal* dssource* dstransit* ///
		dsdest* dsinternal* clsource* cltransit* cldest* clinternal* cssource* cstransit* ///
		csdest* csinternal* csource* ctransit* cdest* cinternal* domesticlaws* enforcement* ///
		convictinfo* prosnum* minstand* efforts* protectprogress* victimid* ///
		victimservices* victimpunish* progress* protocol* ,  by(ccode year)
 
	kap tier1 tier2
	kap source1 source2
	kap source_order1	source_order2 
	kap transit1 transit2  
	kap transit_order1  transit_order2  
	kap destination1  destination2  
	kap destination_order1  destination_order2  
	kap	internal1  internal2
	kap	psource1  psource2
	kap	ptransit1  ptransit2
	kap	pdest1  pdest2
	kap	pinternal1 pinternal2
	kap	lsource1 lsource2
	kap	ltransit1  ltransit2
	kap	ldest1  ldest2
	kap	linternal1  linternal2
	kap	dsource1  dsource2
	kap	dtransit1 dtransit2
	kap	ddest1  ddest2
	kap	dinternal1  dinternal2
	kap	dssource1  dssource2
	kap	dstransit1 dstransit2
	kap	dsdest1  dsdest2
	kap	dsinternal1  dsinternal2
	kap	clsource1  clsource2
	kap	cltransit1  cltransit2
	kap	cldest1  cldest2
	kap	clinternal1  clinternal2
	kap	cssource1  cssource2
	kap	cstransit1 cstransit2
	kap	csdest1  csdest2
	kap	csinternal1  csinternal2
	kap	csource1  csource2
	kap	ctransit1  ctransit2
	kap	cdest1 cdest2
	kap cinternal1 cinternal2
	kap	domesticlaws1  domesticlaws2
	kap	enforcement1 enforcement2
	kap	convictinfo1  convictinfo2
	kap	prosnum1  prosnum2
	kap	efforts1 efforts2
	kap	protectprogress1  protectprogress2
	kap	victimid1  victimid2
	kap	victimservices1  victimservices2
	kap	victimpunish1    victimpunish2  
	kap	progress1   progress2
	kap	protocol1  protocol2
		
		
		
